﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BackgroundTest.BasicAbstracts
{
    /************************************************************************/
    /* Class name: VectorTwoDemention                                       */
    /* Function: A universal 2D int type Vector.                            */
    /************************************************************************/
    public class VectorTwoDimension
    {
        // The x value of x coordinate
        public int x { get; set; }

        // The y value of y coordinate
        public int y { get; set; }

        // The zero vector of VectorTexture
        static public VectorTwoDimension Zero { get; set; }

        /************************************************************************/
        /* Method name: Static Construction Function                            */
        /* Parameters: Initialize the static values.                            */
        /************************************************************************/
        static VectorTwoDimension()
        {
            Zero = new VectorTwoDimension(0, 0);
        }

        /************************************************************************/
        /* Method name: Construction Function                                   */
        /* Parameters: int,int: the position that could be initialized.         */
        /************************************************************************/
        public VectorTwoDimension(int _x, int _y)
        {
            x = _x;
            y = _y;
        }
    }

    /************************************************************************/
    /* Class name: VectorScreen                                             */
    /* Function: Stands for a point on the screen                           */
    /************************************************************************/

    public class VectorScreen
    {
        public int x { get; set; }
        public int y { get; set; }

        /************************************************************************/
        /* Method name: Construction Function                                   */
        /* Parameters: int,int: the position that could be initialized.         */
        /************************************************************************/
        public VectorScreen(int _x, int _y)
        {
            x = _x;
            y = _y;
        }

        /************************************************************************/
        /* Method name: Override operator "+"                                   */
        /* Parameters: VectorScreen*2: the 2 positions to be added.             */
        /************************************************************************/
        public static VectorScreen operator +(VectorScreen v1, VectorScreen v2)
        {
            VectorScreen vs = new VectorScreen(v1.x + v2.x, v1.y + v2.y);
            return vs;
        }

        /************************************************************************/
        /* Method name: Override operator "-"                                   */
        /* Parameters: VectorScreen*2: the 2 positions to be cancelled.         */
        /************************************************************************/
        public static VectorScreen operator -(VectorScreen v1, VectorScreen v2)
        {
            VectorScreen vs = new VectorScreen(v1.x - v2.x, v1.y - v2.y);
            return vs;
        }
    }

    /************************************************************************/
    /* Class name: VectorMap                                                */
    /* Function: Stands for a point on the battle Map                       */
    /************************************************************************/
    public class VectorMap : VectorTwoDimension
    {
        // The zero vector of the class.
        static new public VectorMap Zero { get; set; }

        // The false vector of the class
        static public VectorMap False { get; set; }

        // Static construction function
        static VectorMap ()
        {
            Zero = new VectorMap(0, 0);
            False = new VectorMap(-1, -1);
        }

        // Construction function
        public VectorMap(int _x, int _y):base(_x, _y)
        {
        
        }

        // Convert the map position into a position on screen.
        public VectorTwoDimension GetPosition()
        {
            return new VectorTwoDimension(960 / 2 + x * 60 - y * 60,
                (x + y) * 35);
        }

    }
}
